package com.example.vue20220402.config;

//import com.alipay.easysdk.factory.Factory;
//import com.alipay.easysdk.kernel.Config;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
@Component
//public class AlipayConfig implements ApplicationRunner {
	public class AlipayConfig   {
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000119652546";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCRIUTd5B0c9bHFrImByCDtnndbiz7E8H7zIEzShKJOGVBuNes5bdq5yjzqmKBii6PaIo9xP69RGVe2US8AbWX0HCW/euEx8B20WPv66mfkn290xP5EZaxKKjbvEZI9zBryLuudfFrr1kntjUTGmLn9A9tjB2nQy6Lh369bszi2XLh/m+rrlbXQR3Iq/Q4HMgpBX2R4PZh8cnOESuBauDtrnQjoTQXizYwB0aFH75cjHJEv2O5874Ps8KZMmbrhXETB71vMiIQgqTZatUE3QUTxLxmDnzSaGlLCspQU6sn2eMJ+rg04t9xMoxfaOvqYq2A3K7AmmV8kTrhO4jMuo+0RAgMBAAECggEAa+XkIWP7ERDJfkFsagS0FnV+H51CqYBzoaYd91WMpavEVGvZ2fSGbSKib3fRpfJTe1W+d1/1o8HHqFBrNVIgPoC+v8FHs6zlKLQPgtjLLPosDxB2Sbudf/YqqUrTAwa/8dZYbdmKb1P92pLw0wWxIR7A+LsGPKlpC60V3o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.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjr0HqSZlBZvwU1VL9DbEebVsCJf+yvE84wBCAEkYW5MBdhOj+dsRoZ/Du1BKfKsAdtn2TPsFGGhRiao5uoKW4yOiR91eGigTKKQgE9fSSR6mbK1DpSLDU1Hqh0CWwaptkSFIX48RPAVFycGtuZ3KsdzSBtvW2IrWc54pmiw4/fia2DnqKnPoBDBLKWvyqAccvfXbuACJcfrxnUjbk/PLFfNvAQOeZxZ5QJVLGaZEnfu/FTBXDany2cs4ipTfqaRbGKKRzy1xiTAa3egb/6SkDk8jXS8GHX1K5c+ELCXz6yzYVLgjeknktd9lqvXwC3037lFOnKolC2ZvJzGIWIyb7wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/order/notify";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/payDemo/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";


//	@Override
//	public void run(ApplicationArguments args) throws Exception {
//		Factory.setOptions(getOptions());
//		System.out.println("----支付宝sdk初始化完成-----");
//	}

//	private Config getOptions() {
//		Config config = new Config();
//		//config.protocol = "https";
//		config.gatewayHost = AlipayConfig.gatewayUrl;
//		config.signType = AlipayConfig.sign_type;
//		config.appId = AlipayConfig.app_id;
//		config.merchantPrivateKey = AlipayConfig.merchant_private_key;
//		config.alipayPublicKey = AlipayConfig.alipay_public_key;
//		config.notifyUrl = AlipayConfig.notify_url;
//		return config;
//	}
}

